-
Notifications
You must be signed in to change notification settings - Fork 210
Merge FileImageDescriptor into URLImageDescriptor and clean it up #2899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge FileImageDescriptor into URLImageDescriptor and clean it up #2899
Conversation
e6c5232
to
a1eada2
Compare
Honestly this now feels it become completely unmaintainable and hardly understandable, can we not simply use an abstract base-class to share code instead of all this inlined lamda and hype-generic method calls? |
Test Results 1 523 files - 301 1 523 suites - 301 1h 15m 34s ⏱️ - 16m 26s For more details on these errors, see this check. Results for commit 90ed170. ± Comparison against base commit 2e51edb. This pull request skips 1 test.
♻️ This comment has been updated with latest results. |
I'm not so sure if that becomes much simpler, but I can have a look. |
While looking at both classes again I got the impression that actually the |
bd58803
to
1289fc9
Compare
I have now taken this path further and didn't found a reason speaking against it. The tests should now pass as well. |
3d2506d
to
1f8f8eb
Compare
This contains now much less, i.e. just one additional lambda in the zoom-image computation and is, from my side, ready for submission. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this simplification. I did not check in detail whether everything the FileImageDescriptor did is properly captured by the URLImageDescriptor as well. So far, I just found one place where I am not sure if behavior is properly preserved.
If you want me to do a more in-depth review, let me know, but I am not sure how soon I will find the time for it. So from my side, feel free to further process this PR if you are confident that everything works as expected.
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/URLImageDescriptor.java
Outdated
Show resolved
Hide resolved
1f8f8eb
to
fddf7c8
Compare
5e07d2c
to
1ce2520
Compare
Thank you for your review. Then I think this is ready for submission. With that only a few a few changes remain in Once we have at least one working build I plan to submit this. |
In it's core the FileImageDescriptor queries the given context class for a resource at the given path and then operates on the returned URL or directly fetches the resource's stream. By obtaining the resource's URL immediately and using an URLImageDescriptor with it a lot of similar code and logic from the FileImageDescriptor can be saved. Additionally apply a few minor code clean-ups and remove a unused internal method.
1ce2520
to
90ed170
Compare
@HannesWell Are you aware that this change introduced a test failure in |
My bad, I oversaw that and confused it with the other intermittent test-failure. Sorry and thanks for the heads-up. |
The link is broken. PS. RCPTT tests also broke due to changed |
It was indeed the wrong link, just fixed it.
That's indeed unfortunate. But as you said, the exact result of |
It is not. An application can change icons in its UI at any release and that's effectively what happened. Testing tools comparing icons should not pretend, than nothing has changed, so test failures are expected. I only mention the problem for context, so that bigger picture is more visible. |
Clients will likely have to update their tests anyway, due to the migration from PNGs to SVGs. So I think having both changes in a single release is actually good thing. For example, this is an error now reported by our test suite:
|
By the way previously we have used the Adapter Pattern to gather additional information. e.g. |
Unless the adapter is implemented by JFace, it is no better than direct downcast. And downcast requires internal API access. toString() was used to avoid use of internal APIs. I see that adapter was added in 2022, but RCPTT still supports Eclipse Platform 2019-03, which makes the approach non-universal. |
This does not mean one could try it first and then fallback to the old approach... |
In it's core the FileImageDescriptor queries the given context class for a resource at the given path and then operates on the returned URL or directly fetches the resource's stream. By optaining the resource's URL immediately and using an URLImageDescriptor with it a lot of similar code and logic from the FileImageDescriptor can be saved.
Additionally apply a few minor code clean-ups and remove a unused internal method.